/**
 * Created by YW on 2017/12/12.
 */
$(function () {
    //banner切换
    new Swiper('.banner', {
        slidesPerView: 1,
        spaceBetween: 30,
        loop: true,
        autoplay: {
            delay: 5000,
            stopOnLastSlide: false,
            disableOnInteraction: true
        },
        pagination: {
            el: '.swiper-pagination',
            clickable: true
        },
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev'
        }
    });
    $('.banner .next').click(function () {
        $(this).animateCss('slideOutDown');
    });
    //供应链系统
    var aLi = $('.supply .bd-box li');
    var aImg =  $('.supply .bd-box li .one');
    var aSpan = $('.supply .bd-box li .word');
    aLi.each(function(index){
        $(this).mouseover(function(){
            aSpan.eq(index).stop();
            aImg.eq(index).stop();
            aImg.eq(index).css({zIndex:1}).animate({
                top:37,
                height:0
            },100,'',function(){
                $(this).hide();
                aSpan.eq(index).show().css({zIndex:2}).animate({
                    top:0,
                    height:271
                },100)
            })
        });
        $(this).mouseout(function(){
            aSpan.eq(index).stop();
            aImg.eq(index).stop();
            aSpan.eq(index).css({zIndex:1}).animate({
                top:37,
                height:0
            },100,'',function(){
                $(this).hide();
                aImg.eq(index).show().css({zIndex:2}).animate({
                    top:0,
                    height:271
                },100)
            })
        });
    });
    //合作伙伴
    var aHzhb = $('.hzhb-menu li a');
    aHzhb.each(function(index){
        $(this).mouseover(function(){
            $('.hzhb-menu li span').animate({height:0},'fast');
            $(this).next('span').animate({height:28},'fast');
            $('.hzhb-logo img').hide();
            $('.hzhb-logo .eq-'+index).fadeIn();
            console.log(index);
        });
    });
    //下载app
    $(".icon-iphone").on("mouseenter",function(){
        $(this).attr("src",ROOT+"/static/home/images/icon-iphone-green.png")
    }).on("mouseleave",function(){
        $(this).attr("src",ROOT+"/static/home/images/icon-iphone-red.png")
    });
    $(".icon-android").on("mouseenter",function(){
        $(this).attr("src",ROOT+"/static/home/images/icon-android-green.png")
    }).on("mouseleave",function(){
        $(this).attr("src",ROOT+"/static/home/images/icon-android-red.png")
    });
    //app展示页面，旋转木马
    new Swiper('.show-app', {
        loop : true,
        autoplay: {
          delay: 1500,//1秒切换一次
        },
        effect: 'coverflow',
        grabCursor: true,
        centeredSlides: true,
        slidesPerView: 'auto',
        slideToClickedSlide:true,
        coverflowEffect: {
            rotate: 0,
            stretch: 0,
            depth: 80,
            modifier: 3,
            slideShadows : true
        }
    });
});
function index_open_video(url) {
    layer.open({
        type: 2,
        title: false,
        area: ['854px', '480px'],
        shade: 0.8,
        closeBtn: 1,
        shadeClose: true,
        content: url
    });
}